package com.miszczu.bo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.miszczu.dao.ClassesDao;
import com.miszczu.model.Classes;

@Service
public class ClassesBoImpl implements ClassesBo {

	@Autowired
	ClassesDao classesDao;
	
	public void save(Classes classes) {
		
		classesDao.save(classes);

	}

	public List<Classes> getAllClasses() {
		
		return classesDao.getAllClasses();
		
	}

	@Transactional
	public void delete(Integer id) {
		
		Classes classes = classesDao.getClassById(id);
		classesDao.delete(classes);
		
	}

	public Classes getOne(Integer id) {

		return classesDao.getClassById(id);
		
	}

	public void update(Classes classes) {

		classesDao.update(classes);
		
	}

	public boolean isSubjectInClass(Integer classId, Integer subjectId) {

		return classesDao.isSubjectInClass(classId, subjectId);
	}


}
